package demo8;

import java.util.Random;
import java.util.Scanner;

/*
题目要求：
    根据int变量n的值，来获取随机数，范围是[1,n]
 */
public class Test3Random {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个n的值：");
        int n = sc.nextInt();



        Random ran = new Random();

        for (int i = 0; i < n; i++) {
            int num = ran.nextInt(n)+ 1;

            System.out.println(i+"输出的值是"+num);

        }

    }
}
